import 'package:flutter/material.dart';
import '../model/goods_list.dart';

class GoodsDetailProvider with ChangeNotifier {
  var goodsInfo;
  bool isLeft = true;
  bool isRight = false;

  changeLeftAndRight (String pos) {
    isLeft = pos == 'left';
    isRight = pos == 'right';
    notifyListeners();
  }

  setGoodsInfo (goodsInfo) {
    this.goodsInfo = goodsInfo;
    notifyListeners();
  }

  getGoodsInfo (String goodsId) {
    var goodsInfo = GoodsList.where((element) {
      return element['id'] == goodsId;
    }).toList()[0];
    print('goodsInfo $goodsInfo');
    setGoodsInfo(goodsInfo);
  }
}